#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>       
#include<pthread.h>
#include<sys/epoll.h>
#include<string.h>
#include<netinet/in.h>

#define ERR_LOG(msg) do { \
    printf("在文件 %s 的函数 %s 的第 %d 行\n", __FILE__, __func__, __LINE__); \
    perror(msg); \
    exit(EXIT_FAILURE); \
} while(0)


int main(){

    char *port = "8080";
    char *ip = "192.168.250.100";

    int socket_fd = socket(AF_INET, SOCK_STREAM, 0);

    struct sockaddr_in sockaddr;
    sockaddr.sin_family = AF_INET;
    sockaddr.sin_port = htons(atoi(port));
    sockaddr.sin_addr.s_addr = inet_addr(ip);

    connect(socket_fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));


    char buf[60]={0};
    recv(socket_fd, buf, sizeof(buf), 0);
    printf("buf: %s \n", buf);

    close(socket_fd);
    return 0;
}